package ypmits.clock {
	import flash.display.Sprite;

	/**
	 * @author Dave Lenz
	 */
	public class ClockSkin {
		public var secondsGraphic : Sprite;
		public var minutesGraphic : Sprite;
		public var hourGraphic : Sprite;
		public var fontName : String = "";

		public function validateAnalogue() : Boolean {
			if( hasSecondsGraphic( ) && hasHourGraphic( ) && hasMinuteGraphic( ) ) return true;
			return false;
		}

		
		public function validateDigital() : Boolean {
			if( hasFont( ) ) return true;
			return false;
		}

		
		private function hasSecondsGraphic() : Boolean {
			if( secondsGraphic ) {
				return true;
			} else {
				secondsGraphic = new Sprite( );
				secondsGraphic.graphics.lineStyle( 1, 0, 1 );
				secondsGraphic.graphics.moveTo( 0, 0 );
				secondsGraphic.graphics.lineTo( 110, 0 );
				return true;
			}
		}

		
		private function hasMinuteGraphic() : Boolean {
			if( minutesGraphic ) {
				return true;
			} else {
				minutesGraphic = new Sprite( );
				minutesGraphic.graphics.lineStyle( 2, 0, 1 );
				minutesGraphic.graphics.moveTo( 0, 0 );
				minutesGraphic.graphics.lineTo( 100, 0 );
				return true;
			}
		}

		
		private function hasHourGraphic() : Boolean {
			if( hourGraphic ) {
				return true;
			} else {
				hourGraphic = new Sprite( );
				hourGraphic.graphics.lineStyle( 3, 0, 1 );
				hourGraphic.graphics.moveTo( 0, 0 );
				hourGraphic.graphics.lineTo( 70, 0 );
				return true;
			}
		}

		
		private function hasFont() : Boolean {
			if( fontName ) return true; else return false;
		}

		
		public function dispose() : void {
			secondsGraphic = null;
			minutesGraphic = null;
			hourGraphic = null;
			fontName = null;
		}
	}
}
